package br.com.dev.tcc.util;

import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.provider.Settings;

public class ConnectivityUtil {

	private ConnectivityManager connManager;

	public ConnectivityUtil(Context ctx) {

		connManager = (ConnectivityManager) ctx
				.getSystemService(Context.CONNECTIVITY_SERVICE);
	}

	public boolean isConnected() {

		return connManager.getActiveNetworkInfo() != null
				&& connManager.getActiveNetworkInfo().isConnected();
	}

	public boolean isConnecting() {

		return connManager.getActiveNetworkInfo() != null
				&& connManager.getActiveNetworkInfo().getState().equals(NetworkInfo.State.CONNECTING);
	}
	
	public static Intent getConnectionSettingsIntent() {

		return new Intent(Settings.ACTION_WIRELESS_SETTINGS);
	}
}
